package com.sh.data.engine.domain.datadev.flink.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.sh.data.engine.domain.base.model.PageResult;
import com.sh.data.engine.domain.datadev.flink.model.domain.FlinkJobDomain;
import com.sh.data.engine.domain.datadev.flink.model.domain.FlinkLogRecordDomain;
import com.sh.data.engine.repository.dao.datadev.entity.FlinkJobEntity;
import com.sh.data.engine.repository.dao.datadev.entity.FlinkJobRecordEntity;

import java.util.Date;
import java.util.LinkedHashSet;
import java.util.List;

/**
 * @author: zigui.zdf
 * @description:
 * @date: 2021/6/18 13:47
 */
public interface FlinkJobService extends IService<FlinkJobEntity> {

    Long addJob(
        Long projectId,
        Long nodeId,
        Long versionId,
        Integer taskType,
        Integer execType,
        Date planTime);

    void updateJob(
        Long jobId, LinkedHashSet<String> flinkJobIds, LinkedHashSet<String> yarnApplicationIds);

    void updateJobStatus(Long jobId, Integer status);

    FlinkJobDomain getByFlinkJobId(Long jobId);

    FlinkJobDomain getByNodeId(Long nodeId, Integer execType);

    List<FlinkJobDomain> getRunningJobList();

    List<FlinkJobRecordEntity> getJobStatusList(Long projectId, Integer status, Date start);

    PageResult<FlinkLogRecordDomain> getTaskRecordPageInfo(
        Long projectId,
        String sort,
        Integer pageNum,
        Integer pageSize,
        String taskName,
        Integer taskStatus,
        Integer taskType);

    FlinkJobEntity getDetailById(Long id);

    List<FlinkJobEntity> getJobsByProjectId(Long projectId);
}
